package linklisttest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created with IntelliJ IDEA.
 * Description:
 *
 * @author lzy
 * @create 2018-03-16 上午9:54
 */
public class LinkDemo {
    private static final Logger logger = LoggerFactory.getLogger(LinkDemo.class);

    @SuppressWarnings("ClassCastException")
    public static void main(String[] args) {
        Link all = new Link<String>();
        all.add("yook");
        all.add("text");
        all.add(null);
        all.add("python");
        logger.info("link size:{}", all.size());
        String dat = "text";
        logger.info("link contains {}:{}", dat, all.contains(dat));
        dat = "test";
        logger.info("link contains {}:{}", dat, all.contains(dat));
        int index = 2;
        logger.info("data at {} in the link is {}", index, all.getNode(index));
        all.set(index, "java");
        logger.info("after update");
        logger.info("data at {} in the link is {}", index, all.getNode(index));
        String[] array = (String[]) all.toArray();
        logger.info("array length:{}", array.length);
    }
}
